package org.jay.angla.popwindow;

import org.jay.angla.onlab.R;
import org.jay.angla.onlab.R.id;
import org.jay.angla.onlab.R.layout;

import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

public class PopWinTool extends PopupWindow {

	private View mainView;
	private LinearLayout mSetWavelengthLayout;
	private LinearLayout mDarkCurrentLayout;
	private LinearLayout mRezeroLayout;
	private LinearLayout mSystemBaseLayout;
//	private LinearLayout mTestLayout;
	private LinearLayout mOpenLayout;
	private LinearLayout mSaveLayout;
	private LinearLayout mPrintLayout;
	private LinearLayout mSystemSettingLayout;
	private LinearLayout mParamSettingLayout;

	public PopWinTool(Activity paramActivity, View.OnClickListener listener,
			int paramInt1, int paramInt2) {
		mainView = LayoutInflater.from(paramActivity).inflate(
				R.layout.popwindow_main, null);

		mSetWavelengthLayout = (LinearLayout) mainView
				.findViewById(R.id.layout_set_wavelength);
		mDarkCurrentLayout = (LinearLayout) mainView
				.findViewById(R.id.layout_dark_current);
		mRezeroLayout = (LinearLayout) mainView
				.findViewById(R.id.layout_rezero);
		mSystemBaseLayout = (LinearLayout) mainView
				.findViewById(R.id.layout_system_baseline);
//		mTestLayout = (LinearLayout) mainView.findViewById(R.id.layout_test);
		mOpenLayout = (LinearLayout) mainView.findViewById(R.id.layout_open);
		mSaveLayout = (LinearLayout) mainView.findViewById(R.id.layout_save);
		mPrintLayout = (LinearLayout) mainView.findViewById(R.id.layout_print);
		mSystemSettingLayout = (LinearLayout) mainView
				.findViewById(R.id.layout_system_setting);
		mParamSettingLayout = (LinearLayout) mainView
				.findViewById(R.id.layout_param_setting);

		if (listener != null) {
			mDarkCurrentLayout.setOnClickListener(listener);
			mRezeroLayout.setOnClickListener(listener);
			mSetWavelengthLayout.setOnClickListener(listener);
			mSystemBaseLayout.setOnClickListener(listener);
//			mTestLayout.setOnClickListener(listener);
			mOpenLayout.setOnClickListener(listener);
			mSaveLayout.setOnClickListener(listener);
			mPrintLayout.setOnClickListener(listener);
			mSystemSettingLayout.setOnClickListener(listener);
			mParamSettingLayout.setOnClickListener(listener);
		}
		setContentView(mainView);
		setWidth(paramInt1);
		setHeight(paramInt2);
		// setAnimationStyle(R.style.AnimTools);
		setBackgroundDrawable(new ColorDrawable(0));
	}
}
